import 'dart:async';
import 'dart:convert';
import 'dart:developer';
import 'package:get/get.dart';
import 'package:sports_new/utils/date_time_utils.dart';
import 'package:sports_new/utils/utils.dart';
import 'package:sports_new/view/my/socket_page.dart';
import 'package:web_socket_channel/io.dart';
import 'package:web_socket_channel/status.dart' as status;
import '../../utils/app_config.dart';
import '../../utils/sp_utils.dart';
import '../../utils/user.dart';
import '../../view/my/ali_im_test_page.dart';

typedef AliImEvent = Map<String, dynamic>;

class AliImManager {
  // static final StreamController<AliImEvent> _messageStreamController =
  //     StreamController<AliImEvent>.broadcast();
  static List<String> record = [];

  static void recordAdd(String value) {
    if(!AppConfig.config.isDebug)return;
    var newValue = "${DateTime.now().formatedString("HH:mm:ss.SSS")} $value";
    record.add(newValue);
    if (record.length >= 500) record.removeAt(0);
    try {
      Get.find<AliImTestController>().toEnd();
    } catch (e) {
      log(e.toString());
    }
  }

  // static Stream<AliImEvent> get messageStream => _messageStreamController.stream;
}
